<?php
require_once('conn.inc.php');
@$conn	=	mysql_connect($db_host,$db_user,$db_pwd);
mysql_query("set names 'utf8'");
mysql_select_db($db_name);

$id = $_POST['id'];
$tx = $_POST['tx'];
// $tx = 1;
// $id = 41;
$tsql = "select * from member where id= $id ";
$rt	= mysql_query($tsql);
$row= mysql_fetch_array($rt);
$utx = $row['tx'];

if ($utx != null) {
	$res = unlink($_SERVER['DOCUMENT_ROOT'].$utx);
}

$uptx = "UPDATE member SET tx = '$tx' WHERE id = '$id'";
$ru = mysql_query($uptx);				
$usql = "select * from member where id= $id ";
$ru	= mysql_query($usql);
$xx= mysql_fetch_array($ru);
$uu = $xx['tx'];

if ($uu !== null) {
	$rc = array('code'=>1);								//成功
	echo json_encode($rc);
}else {
	$rc = array('code'=>0);								//为空
	echo json_encode($rc);
}